package com.nuoniu.sibanyun.service.user.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.nuoniu.sibanyun.entity.user.SysUserBank;
import com.nuoniu.sibanyun.mapper.user.SysUserBankMapper;
import com.nuoniu.sibanyun.service.user.ISysUserBankService;
import com.nuoniu.sibanyun.userThread.UserInfo;
import com.nuoniu.sibanyun.userThread.UserThreadLocal;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author baiqiang
 * @since 2020-09-03
 */
@Service
public class SysUserBankServiceImpl extends ServiceImpl<SysUserBankMapper, SysUserBank> implements ISysUserBankService {

    @Override
    public Page<SysUserBank> pageList(Page pages, SysUserBank bank) {
        UserInfo userInfo = UserThreadLocal.get();
        QueryWrapper<SysUserBank> queryWrapper = new QueryWrapper<>(bank);
        queryWrapper.eq("user_id", userInfo.getUserId());
        queryWrapper.orderByDesc("create_date");
        Page page = page(pages, queryWrapper);
        return page;
    }
}
